#include<iostream>
using namespace std;
class Solution {
public:
    int reverse(int x) {
        long long  ans = 0;
        long long ws = 1;
        long long xx = x/10;
        while (xx)
        {
            ws *= 10;
            xx /= 10;
        }
        xx = x;
        while (xx)
        {
            
            ans += (xx % 10) * ws;
            ws /= 10;
            xx /= 10;
        }
        int anst = ans;
        if (anst != ans)return 0;
        return ans;
    }
};
int main()
{
    Solution s;
    int n = 2147483646;
    cout << s.reverse(n) << endl;
}